perm filename USEM11[P11,LCS]2 blob sn#519436 filedate 1980-06-30 generic text, type T, neo UTF8
00100	      **********  Using the Stanford-IRCAM MUSIC Program **********
00200	        
00300	      ******* WORK IN PROGRESS -- FEB 79 -- LELAND SMITH *********
00400	        
00500	      This manual is designed for use with the  PDP10  at  the  Stanford AI 
00600	      lab.  In most cases this text will also apply to the  program in  use
00700	      at the IRCAM lab in Paris as well as MUSIC5 type programs.
00800	        
00900	      MUS11 is a complete sound generating  package  which  exists  on  the
01000	      disk.  For first attempts type:
01100	        
01200	      	R MUS11 	
01300	      	(All lines must be terminated with the 'RETURN' key.)
01400	        
01500	      At this point the program will type the message:
01600	        
01700	      	INPUT?
01800	        
01900	      Basically  there  are  two responses possible.   If the program is to
02000	      receive  further  instructions  from  another  file  which  has  been
02100	      prepared with an editing program, type:
02200	        
02300	      	NAME -- where NAME is the name of the file to be read.
02400	      			(This program only reads files with no extension
02500				 or with the extension .DAT.)
02600	        
02700	      If instructions are to be entered by means of the  teletype  keyboard
02800	      (TTY mode), type carriage return (<CR>).
02900	        
03000	      At  this  point the sign  (>)  will appear which means the program is
03100	      awaiting input.
03200	        
03300	        
03400	      Most complete statements  to  be  read  by  MUS11  must  end  with  a
03500	      semicolon.  Several  complete  statements  may be entered on a single
03600	      line but it is best not to have the lines too long.   More  than  one
03700	      line  may  be used for a single statement.  If the less-than sign (<)
03800	      appears everything following on that line will be ignored.  Use  this
03900	      for entering comments.
04000	        
04100	              *****  Note  that  the above rules DO NOT apply to the syntax
04200	      	of the SCORE program.
04300	        
04400	      Already  present  in MUS11 is an "instrument" known as SIMP which has
04500	      been set to play a test tone of 'A' (440 hz) for 1/2 second.
04600	        
04700	      In  order  to  play  this  tone, first get into TTY mode as described
04800	      above, then type:
04900	        
05000	      	SIMP;FINISH;             (The statement 'PLAY;' is not needed.)
05100	        
05200	      When the computation ends "TEST.SND"  will be typed out.  This  means
05300	      that  sound  data has  been   written  on  the  disk  under  the name
05400	      "TEST.SND."   You will also be given  other information  such  as the
05500	      maximum amplitude encountered, the number of  bits  per  sample, etc.
05600	
05700	      Immediately  after   this   the  following   message   will   appear:
05800	      PLAY?   At this point hitting <CR> will cause
05900	      computed sound to play (unless someone else's program  has  momentary  
06000	      control  over  the devices you need.)  Each time you hit the "RETURN" 
06100	      key the process will be repeated.
06200	
06300	      The sound will  be playing  at SPEED  1.  Type  S to  change the  playback
06400	      speed.  Then you must type a number from 0 to 5 to set the playback speed.
06500	      0 plays 1/2 as fast as 1, hence an octave lower; 2 plays twice as fast;  3
06600	      plays four times as  fast; 4 plays  eight times as  fast; 5 plays  sixteen
06700	      times as fast.  If you type "X" the program will exit from the "play" mode
06800	      and return to 'INPUT?', which means it is waiting for some new command.
06900	      								             
07000	      The speed at which the sound will play is determined by the  sampling
07100	      rate which was  used during  the computation.   The default  sampling
07200	      rate in 'MUS11' is 12800.  (See later  on how  to change this.) 
07300	
07400	      If  you have typed an "X" but wish to return to "play" mode, type %  
07500	      to the question 'INPUT?'.
07600	
07700	
07800	      ******************************************************
07900	
08000	      The instrument SIMP has five parameters.
08100	
08200			P1 = begin time of note (in seconds)
08300			P2 = duration of note     "     "
08400			P3 = pitch
08500			P4 = amplitude
08600			P5 = wave form (or timbre)
08700	        
08800	      P1 and P2 will have the same significance in all instruments but  all
08900	      higher   numbered   parameters   are  assigned   roles  according  to
09000	      convenience.  (However  it  will  prove  useful to  apply  P3  and P4
09100	      consistently as above.)
09200	        
09300	      Internally all pitch entries become  numerical,  however  the  twelve
09400	      frequencies  of  the  tempered chromatic scale, from middle C (261.62
09500	      hz) up to B may be used in MUS11 by typing the letter  names  of  the
09600	      notes. The letters S = #  and   F = flat.
09700	        
09800	      Since  these  letters  merely represent the frequencies of each note,
09900	      the octave range  may  be  changed  by  multiplying  or  dividing  by
10000	      multiples of two.   Thus C or A in the octave below middle C would be
10100	      entered as C/2 or A/2.   In the octave above the basic middle  octave
10200	      these notes would be C*2 or A*2.
10300	        
10400	      	C -- 2 octaves down would be C/4
10500	      	C -- 3 octaves down would be C/8
10600	      	C -- 2 octaves up would be C*4
10700	      	C -- 3 octaves up would be C*8 etc.
10800	        
10900	      To test the use of these letters try:
11000	        
11100	      	P3←C;SIMP;FINISH;       ('FINI;' may be used in place of 'FINISH;')
11200	        
11300	      Now instrument SIMP  will compute middle  C instead of  A.  The  left
11400	      arrow (←)  indicates that  the value  of  C has  been placed  in  P3,
11500	      replacing any value that was  previously there.  (The left arrow  and
11600	      the equals  sign[=] are  interchangeable in  this program.   In  some
11700	      printings the left arrow will appear  as an "underline"[-].   Try not
11800	      to be confused by this.)
11900	        
12000	      SIMP;FINISH;  must  be typed so the new note will be computed.
12100	      After it is first heard it may be repeated as indicated above.
12200	        
12300	      If frequencies other than those of  the  tempered  scale  are  to  be
12400	      played, a number may be used instead of a letter.
12500	        
12600	      	P3=1000; SIMP;FINISH; will play a tone at 1000 hz.
12700	        
12800	        
12900	      The amplitude scale available is the range of numbers from 0 to 2047.
13000	      (This  upper  limit  is  set  by the number of bits [12] used for the
13100	      sound samples.  See appendix.) P4 has been set at 1000 for  the  test
13200	      tone.  This may be reset using the same method as described before.
13300	        
13400	      	P4=100;P3=GS*2;  SIMP;FINISH;
13500	        
13600	      This will play a G# above the middle octave at amplitude 100.
13700	        
13800	      The duration of the tone may be changed be resetting P2.
13900	        
14000	      	P2=.1;  will play a note of 1/10 sec. duration.
14100	        
14200	      In general, test tones should rarely exceed 1" duration.
14300	        
14400	      When several parameters are to  be  changed  at  once  the  following
14500	      type-in format should be used:
14600	        
14700	      	SIMP 0 .2 FS/2 850;FINI;
14800	        
14900	      This will play F# below middle C for 2/10" at an  amplitude  of  850.
15000	      (Please  note  that  P5,  the  wave form for SIMP, will be dealt with
15100	      later.)
15200	        
15300	      **********  COMMAS  **********
15400	        
15500	      Commas may be used to separate the parameters and if nothing precedes
15600	      a  comma  the contents of that parameter remains unchanged.  Also any
15700	      parameter numbers higher than the length of  the  list  will  not  be
15800	      affected.
15900	        
16000	      	SIMP , .3, , 1200;FINISH;  changes only P2 and P4.
16100	        
16200	      ******************************************************
16300	        
16400	      A string of notes may be played with the following input:
16500	        
16600	      	 SIMP 0 .2 C 1500;SIMP .2, , D;SIMP .4, , E;
16700	      	 SIMP .6, , C;FINISH;
16800	        
16900	      In this case P1 must be updated for  each  note.  (Never  overlap  an
17000	      instrument  with  itself.   Distortion  will  occur.)  P2,  the  note
17100	      duration remains unchanged, so the commas suffice for the last  three
17200	      notes.  P4, coming at the end of the list for  the  first  note  need
17300	      only be stated once if it is not to change.
17400	        
17500	      Rests  are created by simply leaving some time between the end of one
17600	      note (P1+P2) and the beginning of the next (the new P1).
17700	        
17800	      	 SIMP 0 .2 C;SIMP .5;FINISH; will play C  for  2/10",
17900	      rest for 3/10" and then play another C for 2/10".
18000	        
18100	        
18200	      **********  FUNCTIONS  **********
18300	        
18400	      The  wave  form  in P5 is entered by means of a name which is used by
18500	      the program to locate a  list,  or  array,  of  numbers  (512)  which
18600	      describe  the wave.  The names used for this purpose will always be F
18700	      followed  directly  by  a  number.    These  arrays  will  be  called
18800	      "functions."
18900	        
19000	      There are 6 functions in MUS11 when you first run it.   These can  be 
19100	      changed at any time.  The functions present are F1, F2, F3, F4, F5 and
19200	      F6.  F2 and F3 are  used  for envelopes, F1 describes a sine wave and
19300	      F4, F5 and F6 are more complicated timbres.
19400	        
19500	      Functions are created
19600	      within  MUS11  itself  by means of two routines called SIN and SEG.
19700	      SIN is used to create composites made by adding  various  harmonics
19800	      together.  The form of F1 could be changed in the following manner:
19900	        
20000	      	SIN  1   1  1  .5;
20100	        
20200	      The first number tells MUS11 that you will define F1.  The next three 
20300	      numbers give the relative amplitudes of the first 3 harmonics.
20400	      If any harmonic is to be omitted, a zero must appear in the list.   
20500	      In the example the ratios of harmonics 1, 2 and 3 will be 1:1:.5 .
20600	      To get harmonics up to the 5th in the ratios of .7:1:0:.2:.1 type--
20700	
20800		SIN 1  .7 1 0 .2 .1;
20900	        
21000	      The size of each number  is important only  in  its
21100	      relation to the other amplitude numbers.
21200	        
21300	      Several pairs may entered and harmonic numbers up to 256 may be  used
21400	      but  in  practice  great  care  must be taken to avoid the "foldover"
21500	      effect which  occurs  when  frequencies  higher  than  one  half  the
21600	      sampling rate are present. (See appendix.)
21700	        
21800	      It should be pointed out that the fundamental (harmonic #1) need  not
21900	      be present in a wave.
22000	        
22100	         SIN  1  0 0 0 0 0  0 0 0 0 1  0 1 0 0 1; will give the three notes
22200	      of a minor chord (i.e. harmonics number 10, 12 and 15).   After  this 
22300	      has been  entered  the  following will cause a C minor chord to play:
22400	        
22500	      	 SIMP 0 .5 GS/8;FINISH;
22600	        
22700	      While the lowest Ab (or G#) on the piano keyboard has been indicated,
22800	      since  the wave form includes only the 10th, 12th and 16th harmonics,
22900	      the notes middle C, Eb and G will be heard.
23000	        
23100	      Several  experiments  with  different  wave forms should be made.
23200	        
23300	      A function may be changed in the middle of a PLAY routine but it must
23400	      be  noted that the new wave definition must follow! the note which it
23500	      is to affect.
23600	        
23700	            In 	 SIMP 0 .3 D 1000; SIMP .3; 
23800	                SIN  1     .7 0 .2 0 .1 ; 
23900	                SIMP .6,,E; FINISH;
24000	        the newly defined wave will be heard in the second and third notes.
24100	        
24200	        
24300	        
24400	      The following example will play a sequence of notes wherein are heard
24500	      the 10th, 14th and 18th harmonics of a low C, then the 10th, 13th and
24600	      16th, and finally the 10th, 12th and 14th harmonics.
24700	        
24800	      	SIN  1  0 0 0 0 0   0 0 0 0 1   0 0 0 1 0   0 0 1 ;
24900	      	SIN  2  0 0 0 0 0   0 0 0 0 1   0 0 1 0 0   1 ;
25000	      	SIN  3  0 0 0 0 0   0 0 0 0 1   0 1 0 1 ;
25100	      	 SIMP 0 .3 C/4 2000 F1;
25200	      	SIMP .3,,,,F2;SIMP .6,,,,3;FINISH;
25300	        
25400	        
25500	        
25600	              From this point on it would probably be better to prepare any
25700	      input  for MUS11 which requires more than a couple of lines of typing
25800	      with the SOS or ET editors.   Typographical errors are inevitable and
25900	      when an error is made near the beginning of a string of  input  typed
26000	      directly to MUS11 you most likely will have to retype everything.
26100		MUS11 will NOT read ET directory pages -- so all ET editing must be
26200		done using the the /N feature (supresses the directory).
26300		If SOS is used, the line numbers must be removed with the COPY 
26400		program.  (Type 'COPY NAME/N' to remove line numbers from file NAME.)
26500	
     

00100	      A type of flow-chart diagram for SIMP would appear as follows:
00200	        
00300	      		 P4        FP3
00400	      		  !         !
00500	      		  !         !
00600	      		***************
00700	      		*             *    OSC
00800	      		*             *    
00900	      	        *     P5      *
01000	      	         *           *
01100	      		  *         *
01200	      		   *********
01300	      		   B2  !
01400	      		       !
01500	      		     *****
01600	      		    * OUT *
01700	      		    * B1  *
01800	      		     *****
01900	        
02000	      The top left input, P4, serves simply as a multiplier for the numbers
02100	      found  in  the  wave  form array, P5.  The particular number from the
02200	      array to be multiplied is determined by the number in the upper right
02300	      input.   The upper  right  input, in this case FP3, when processed by
02400	      the "translator" in MUS11  becomes the increment, the rate  at  which
02500	      the  wave form array is stepped through.  'FP' stands for 'frequency'
02600	      parameter, i.e., a parameter which is to be converted to the proper
02700	      increment number to act as a frequency (how many TIMES per second).
02800	      This is opposed to a 'duration' parameter, 'DP', which converts to
02900	      act as a duration (how many SECONDS to go through the function).
03000	        
03100	      The  maximum  size of the numbers in the wave array is + or -1.  Thus
03200	      if P4 is set to 1000 the output of the OSC  will  be numbers  in  the
03300	      range  +1000  to  -1000 which will describe the wave form put into P5
03400	      cycling at the rate given in P3.
03500	        
03600	        
03700	      The code for entering this instrument follows:
03800	        
03900	      	INS 1;  
04000	        SIMP
04100	        ;
04200	      	OSC  P4  FP3 B2 P5;
04300	      	OUT  B2 B1;
04400	      	END;
04500	        
04600	      The 2nd number after 'INS' (the 1st is a dummy) gives the number for
04700	      this particular instrument definition.
04800	      After the 'INS' statement all the names to be associated with this
04900	      particular intrument number may be listed.  A semicolon MUST appear
05000	      in column 1 to end the list of names.  Currently a total of 27 
05100	      different names can be used and 15 different instrument definitions.
05200	      Instrument names can have no more than FOUR letters and must not be
05300	      the same as any of the program's reserved words.  (To see a list of
05400	      reserved words, type <CR> and then WORD; <CR>.)
05500	 
05600	      This  instrument  has  only  one unit generator (the OSC)  hence  the
05700	      output (in B2) is added to the contents of B1 in the OUT box. If there 
05800	      are  several instruments the  outputs  of all the instruments will be 
05900	      combined in B1 for each sample.  B1 is a storage array of 512 words.
06000	      Every time B1 is filled its contents will be written on the disk.
06100	        
06200	      It will be noticed when playing instrument SIMP that the sound begins
06300	      and ends quite abruptly.  This is because  no  attack-decay  envelope
06400	      has been applied to the tone.  The sound begins at the full amplitude
06500	      of P4 and remains at that level for  its  total  duration.
06600	        
06700	
     

00100	      To apply an envelope, another unit generator must be added.
00200	        
00300	        
00400	      		 P4         P2
00500	      		  !         !
00600	      		  !         !
00700	      		***************
00800	      		*             *    OSC
00900	      		*             *    
01000	      	        *     P5      *
01100	      	         *           *
01200	      		  *         *
01300	      		   *********
01400	       		   B2  !
01500	      		       ! 	 FP3
01600	      		       !         !
01700	      		       !         !
01800	      		     ***************
01900	      		     *             *    OSC
02000	      		     *             *    
02100	      	             *     P6      *
02200	      	              *           *
02300	      		       *         *
02400	      		        *********  		INS 2         
02500	      		        B2  !			TOOT
02600				    !			;
02700	      		          *****			OSC  P4 P2  B2 P5;
02800	      		         * OUT *		OSC  B2 FP3 B2 P6;
02900	      		         * B1  *		OUT  B2 B1; 
03000	      		          ***** 		END;
03100	        
03200	      To create  this  instrument the definition listed above must be typed
03300	      in.  Now that the instrument has been expanded you will note that  it
03400	      is the output of of the second OSC  which goes to OUT.  Note that B2
03500	      through B6 may be reused several times in an instrument.
03600	      P2 will have the duration of each note to be played.  DP2 could be
03700	      used but MUS11 always expects P2 to be treated as a duration anyway.
03800	      P5 will now contain the envelope array.   This array is best  defined
03900	      by the SEG routine.   SEG defines the positions of line segments used
04000	      to approximate a curve.   With SEG several pairs of  numbers  may  be
04100	      entered.   After the first number, which defines the function number,
04200	      the first number of each pair is an amplitude, normally in
04300	      the  range of 0 to 1, and the second is the step number in the array.
04400	      The step numbers 1 through 100 are used in SEG.   (However  the  step
04500	      numbers are  converted  internally to 512 array locations.)  Straight
04600	      line segments are drawn between each of the  points  defined.     The
04700	      following would put a triangular envelope shape into F3.
04800	        
04900	      	SEG  3   0,1  1,50  0,100;
05000	        
05100	          Note that the routine is terminated when step 100 is reached.
05200	        
05300	      After having typed in the code for instrument TOOT and the definition
05400	      for an  envelope in F3,  the following will produce a note using that
05500	      envelope:
05600	        
05700	      	SIN 1  1  .4 .1 ;< Sets the tone color.
05800	      	 TOOT 0 .5 A 2000 F3 F1;FINISH;
05900	        
06000	      If two envelopes are to be contrasted add another function and define
06100	      it.
06200	
06300	      	SEG  2  0,1  1,7  .2,25  .1,60  0,100;< Staccato
06400	
06500	      	 
06600	        TOOT 0 .2 1000 2000 F2 F1;  < P5 has envelope
06700	      	TOOT .2 .5,,,F3;
06800	        FINISH; < Plays stac. then sust.(F2 then F3)
06900	        
07000	
     

00100	      In the next example a unit generator will be added  above  the  right
00200	      side  of  the  bottom,  tone producing unit generator.  In this way a
00300	      function may be used to describe fluctuations  of  pitch  within  the
00400	      duration  of  a  note  --  much  as  the  previous  example  gave the
00500	      possibility for changing the amplitude during a single note.
00600	
00700	      				       FP7   FP3
00800						 !   !
00900					        -!---!-
01000						\     / SUB
01100						 \ - /
01200						  \-/        DP8
01300	      	 P4         P2		        B3 !         !
01400	      	  !         !			   !         !
01500	      	  !         !			 ***************
01600	      	***************			 *	       *   OSC
01700	      	*	      *	 OSC		 * 	       *   
01800	      	*             *         	 *     P9      *
01900	      	*     P5      *      		  *           *
02000	         *           * 			   *	     *
02100	          *         * 			    *********
02200	      	   ********* 	      FP3	    B3	!
02300	      	   B2  !	       !   -------------!
02400	      	       !--------      -!---!-
02500	      		       !      \     /  AD2
02600	      		       !       \ + /
02700	      		       !        \-/
02800	      		       !         ! B3
02900	      		       !         !
03000	      		     ***************
03100	      		     *		   *
03200	      	       OSC   *             *
03300	      	             *     P6      *
03400	      	              *           *
03500	      		       *         *
03600	      		        *********     INS 3;          
03700	      		        B2  !	      GLIS
03800	      		            !	      ;
03900	      		            !	      SUB FP7 FP3 B3 ;   
04000	      		          *****	      OSC B3  DP8 B3 P9 ;
04100	      		         * OUT *      AD2 B3  FP3 B3 ;
04200	      		         * B1  *      OSC P4  P2  B2 P5 ;
04300	      		          *****       OSC B2  B3  B2  P6;
04400	      		                      OUT B2  B1;
04500	      		                      END;
04600	        
04700	      The top unit generator, 'SUB' causes the 2nd input to be subtracted
04800	      from the 1st.  In this case P3 will have the starting frequency of
04900	      the glissando and P7 will have the frequency of the goal of the
05000	      glissando.  (These are both frequencies, hence, FP7 and FP3.)
05100	      Since P3 will be entered further down, at this point we use the SUB
05200	      box to get the difference between the two frequencies, which, after
05300	      being processed by the next OSC, will be added to P3 at the AD2 box.
05400	      In order for this instrument to perform glissandos, a third  function
05500	      must  be  defined  for P9 (the "shape" of the glissando).  A straight
05600	      line slope will suffice for a simple glissando.  After typing in  the
05700	      instrument definition set up the three functions.
05800	        
05900	      	SEG  5  0,1  .8,7  1,12  1,90  0,100;<Envelope
06000	      	SEG  6  0,1  1,100; <Slope
06100	        
06200	      The following will play a glissando up two octaves, from C to C*4.
06300	        
06400	      	  GLIS 0 1 C 2000 F5  F1 C*4 1 F6; FINISH;
06500	        
06600	      If P8=.5; (while P2 remains at 1) two glissandos will be heard.
06700	      (Note that P8 is listed in the instrument as DP8, a duration.)
06800	        
06900	        
07000	        
07100	      This  instrument  may  be  used  for  a  dramatic  demonstration   of
07200	      "foldover", the phenomenon  which occurs when a frequency exceeds the
07300	      upper limit of one half the sampling rate.  (See Mathews' book for  a
07400	      technical explanation.)
07500	        
07600	      For this purpose it is best to use a Sine wave in P6.
07700	        
07800	      	SIN  1   1 ;     <note that this original form of F1
07900	        
08000	      	  GLIS 0 1 1000 2000 F5 F1 4000 1 F6;FINISH;
08100	        
08200	      This first note will slide up from 1000 hz to 4000 hz.
08300	        
08400	        
08500	      	  GLIS 0 1 1000 2000 F5 F1 11800 1 F6;FINISH;
08600	        
08700	      Due to "foldover" (at 12800/2 hz.) this note will slide up to 6400 hz
08800	      and return to the 1000 hz level even though 11800 hz was given in P7.
08900	      The  general rule for "foldover" is that any frequencies which exceed
09000	      one half the sampling rate will be heard at (SRATE-F) hz.
09100	        
09200	        
09300	      Try this one!
09400	        
09500	      	  GLIS 0 1 0 2000 F5 F1 30000 1 F6; FINISH;
09600	        
09700	        
09800	      This same instrument may be used to produce a vibrato  by  putting  a
09900	      sine  wave into P9, setting P8=1/7; (the vibrato rate will be 7 times
10000	      per second) and making P7 some very small amount different from P3.
10100	        
10200	      	  GLIS 0 1 C 2000 F5  F1 C+2 1/7 F1; FINISH;
10300	        
10400	      		(It is assumed that F1 is a sine wave.)
10500	
     

00100		      Various types of noise  and  other  random  fluctuations  are
00200	      produced  by the two random number unit generators.  These are called
00300	      RAH and RAN.   RAH  (H=hold)  produces  in  effect  a  function  made
00400	      up  of  horizontal  lines at various levels with a perpendicular jump
00500	      from  one  level to the next.  There are  two  inputs  to  RAH.   The
00600	      first   (left  hand)  gives  the  range,  plus  or  minus,  of random
00700	      selection and the second (right hand) gives the rate (per  second) at
00800	      which the selections are to be made.
00900	        
01000	      	      Care  must  be  taken with the number in the first input.  If
01100	      the number 100 is given, the output of  RAH  will  fluctuate  between
01200	      +100  and  -100.  Thus if a range of 100 to 200 is desired, the input
01300	      number should be 50 and the number 150 must be added to the output.
01400	        
01500	        
01600	      				          FP7       FP8  
01700	      	 P4         P2  	           !         !
01800	      	  !         !		           !         !
01900	      	  !         !			 ***************
02000	      	***************			 *	       *
02100	      	*	      *	 OSC  		 *     RAH     *
02200	      	*             *         	 ***************
02300	      	*     P5      *      		    B3  !
02400	         *           * 			        !
02500	          *         * 			        !
02600	      	   ********* 	      FP3		!
02700	     	   B2  !	       !   -------------!
02800	      	       !--------      -!---!-
02900	      		       !      \     / AD2
03000	      		       !       \ + /
03100	      		       !        \-/
03200	      		       !         ! B3
03300	      		       !         !
03400	      		     ***************
03500	      		     *		   *
03600	      	     OSC     *             *
03700	      	       	     *     P6      *
03800	      	              *           *   INS 1;
03900	      		       *         *    NOIS 
04000	      		        *********     ;
04100	      		        B2  !	      OSC P4 P2 B2 P5;
04200	      		            !	      RAH FP7 FP8 B3;
04300	      		          *****	      AD2 B3 FP3 B3;
04400	      		         * OUT *      OSC B2 B3 B2 P6;
04500	      		         * B1  *      OUT B2 B1;
04600	      		          *****       END;
04700	        
04800	 
04900	      			SEG 2  0,1  .8,7  1,12  1,90  0,100;<Env.
05000	        
05100	        
05200	        
05300	        
05400	      	The following will produce white noise.
05500	        
05600	      	SRATE=25600;
05700	      	 NOIS  0 .5 C*8 1000 F2 F1 P3 P3*8;FINISH;
05800	        
05900	      	      Actually  P8 (given as P3*8) can probably be left at a number
06000	      like 4000 for  noise  purposes.    As  P7  is  changed  the  apparent
06100	      band-width  of  the  noise  will  be changed.  As the band-width gets
06200	      narrower the center frequency becomes more apparent. Thus if P7=P3/16
06300	      and  P3 is up in the range of C*8, something of the effect of blowing
06400	      across an open tube will be produced.  The  pitch  is  clear  --  but
06500	      quite windy.
06600	        
06700	      	      The  SRATE  (sampling  rate)  must  be  increased  for  noise
06800	      production since very high frequencies are essential.  At SRATE=25600
06900	      the high frequency cut-off will be at 12800 hz.
07000	        
07100	        
07200	      	If P8 is set to a  low  number  (e.g.  8)  individual  random
07300	        pitches, instead of noise, will be produced at that rate.
07400	        
07500	        
07600	      	      If  the  random unit generator  is  replaced  by  a  RAN  the
07700	      random  function  produced  will  be  made  up  of a series of slopes
07800	      (interpolation)  up  and down from one random point to  another.   In
07900	      the  case of noise production there is little difference between  RAN  
08000	      and  RAH.  However RAN  is  necessary  for  getting  such  things  as
08100	      random  vibrato.    The following will produce an acceptable, "human"
08200	      sounding vibrato.
08300	        
08400	      	  NOIS  0 1 C*2 1000 F2  F1 P3*.01 16; FINISH;
08500	        
08600	      	      The random rate of 16 per  second  (in  P8)  is  considerably
08700	      faster  than  the  human  vibrato rate of 5 to 8 per second.  In this
08800	      case however since  the  full  band-width  (in  P7)  is  only  seldom
08900	      attained and the heard effect is that of a rate much slower than 16.
09000	        
09100	
     

00100	      With an ordinary OSC there  is no simple way to  have  a  long  note
00200	      keep  the  same  characteristics of attack and decay as a short note.
00300	      The ENV  unit  generator is used to create  envelopes  with  separate
00400	      controls over attack time, steady state and decay time.
00500	        
00600	        
00700	      	  	 DP7  DP8  DP9
00800	      	 	  !    !    !
00900	      	P4	  !    !    !        P10
01000	      	! 	***************       !
01100	      	!      *               *      !  ENV
01200	      	!     *                 *     !
01300	      	!--- *        P5         * ---!
01400	      	    *                     *
01500	      	   *                       *
01600	      	  ***************************
01700	      		   B2  !
01800	      		       ! 	FP3    
01900	      		       !         !
02000	      		       !         !
02100	      		     ***************
02200	      		     *             *    COS  
02300	      		     *             *    
02400	      	             *     P6      *
02500	      	              *           *       INS 3;
02600	      		       *         *	  ENV
02700	      		        *********  	  ;
02800	      		        B2  !		  ENV P4 P5 B2 DP7 DP8 DP9 P10;
02900	      		            !		  COS B2 FP3 B2 P6;
03000	      		          *****		  OUT B2 B1;
03100	      		         * OUT *	  END;
03200	      		         * B1  * 	
03300	      		          *****
03400	        
03500	        
03600	        
03700	      The  parameter arrangement for ENV  is rather different from that for
03800	      OSC.  The  far  left parameter (P4) is, as usual, an amplitude input.
03900	      The  next  item  in  the  parameter  list  (P5 here) will contain the 
04000	      envelope array name.  The next three (P7, P8 and P9 in this particular
04100	      example)  will receive the attack duration, the total duration and the 
04200	      decay duration of the envelope, in  that  order.   
04300	        
04400	      The 2nd parameter (P8) of this group  could  have  been  P2.  However 
04500	      since  P2  is  always  a  special  parameter which tells how long the 
04600	      instrument is to be turned, its  use  to  indicate the total duration 
04700	      of the envelope would make it impossible to play several notes within 
04800	      one envelope cycle (a phrase.)
04900	        
05000	      P10 plays a very special role.  Normally the  number 1  should  be in
05100	      this parameter when there will be only a  single  note  heard  in the
05200	      duration  of  each complete envelope.  (The 1 causes the main pointer
05300	      to be initialized at the start of each new note.) If, however, two or
05400	      more  notes  are to be played in the duration of one pass through the
05500	      envelope, P10 must be set to 0 for the first note (the "attack note")
05600	      and  then  all subsequent notes under the same envelope will have P10
05700	      set to -1.  (The -1 tells ENV to NOT reinitialize its pointer.)
05800	     
05900	      In  the  first  case  above (where P10=1) an instrument using the ENV
06000	      generator  can  be  used  to  play  on  top  of itself like any other 
06100	      instrument.  However, if the continuation feature is used, (P10=0 and
06200	      then P10=-1)  there  can be NO overlapping of notes with this instru-
06300	      ment  (because  the main pointer would get confused).  In this latter
06400	      case  several copies of the instrument code must be made, each with a
06500	      different instrument number.  Thus a chord could be played by instru-
06600	      ments 1, 2 and 3, but not by  instrument 1 playing 3 notes  at  once.
06700	
06800	      To summarize:
06900	
07000	        P10=1=NO CONTINUATION, REINITS EACH NOTE, CAN PLAY ON TOP OF SELF.
07100	        P10=0=INITS CONTINUATION FOR SEVERAL NOTES UNDER 1 ENV.
07200	        P10=-1=CONTINUATION	(USE DIFFERENT INS. NUMS FOR CHORDS!!)
07300	
07400	      (**** When using -1 in a parameter list be sure to precede it by a
07500	      comma.   e.g.   .04, -1;  might appear for P9 and P10. *****)
07600	
07700	      The array used for ENV  must  be defined in a special way.  Only  the
07800	      first 3/4 of the available locations are to be used.  When using SEG,
07900	      steps 1-25 are reserved for the attack portion, steps 26-50  for  the
08000	      "steady  state"  and steps 51-75 for the decay portion.  Steps 76-100
08100	      are ignored by ENV  but  must be included in the SEG input  in  order
08200	      for  the SEG routine to conclude properly.  To test the properties of
08300	      ENV it is best to construct an envelope with dramatic changes.
08400	        
08500	      	SEG 2   0,1  1,3  .3,25  1,50  0,75  0,100;  <F2  ENVELOPE
08600	        
08700	      If parameters 7, 8 and 9 are set properly, this  array  will  give  a
08800	      sharp  attack  followed  by  a  return to a low amplitude (.3) at the
08900	      start of the "steady state"  section.   Following  there  will  be  a
09000	      relatively  slow  crescendo to full amplitude and then a rapid decay.
09100	      It must be emphasized that the sum of the values given for P7 and  P9
09200	      (attack  and  decay)  must  never  exceed  the  value  of  P8  (total
09300	      duration.) Likewise, P8 should never be less than P2, (the total time
09400	      the instrument is turned on for a single note.) To visualize the true
09500	      shape of the envelope for any particular note duration (ND)  consider
09600	      that  the  time  spent in the middle section of the array (SS="steady
09700	      state" area) will be what is left when the attack (AT) and decay (DK)
09800	      are subtracted from the total duration (TD.)
09900	        
10000	      	SS = TD - AT - DK
10100	        
10200	 
10300	          SRT←12800;
10400	      	  ENV 0 1 A 2000 F2 F5 .08 1 .08 1; FINI;
10500	        
10600	        
10700	      In  the  following,  the 2 notes D, F will be connected (phrased) and
10800	      the 3rd note, C#, will be detached.   Notice  that  the  first  value
10900	      given  in  P8  (total  duration  of  envelope)  represents  the total
11000	      duration of the first 2 notes.  P8 is changed to  equal  P2  for  the
11100	      separate note.
11200	        
11300	        ENV 0 .5 D 2000 F2 F1 .08 1 .08 0;
11400	        P10=-1;
11500	      	ENV .5 .5 F;    < P4 to P9 remain the same.
11600	      	ENV  1 .5 CS 2000 F2 F1 .08 .5 .08 1;
11700	      	FINI;
11800	        
11900	        
12000	      You will have noticed that the last unit generator in this instrument
12100	      is called a COS.   This  is  exactly  like  an OSC  except  that  the
12200	      pointer  to  the array is never re-initialized.  This allows the wave
12300	      form produced to be continuous from one note to the next.   (The  "C"
12400	      indicates  it  is a "continuing" oscilator).  If an OSC  were used in
12500	      this situation, clicks would often be heard between phrased notes.
12600	        
12700	
     

00100	      	      Frequency modulation allows for  the  production  of  a  wide
00200	      variety  of  tone  colors  using relatively little compute time.
00300	        
00400	                P8---   ---P7
00500	                   -!---!-        
00600	                   \     /  
00700	                SUB \ - /        
00800	                     \-/     -   FP9
00900	                   B3 !--   / \  /
01000	                         \ /   \/ 
01100	                          /  X  \  MLT
01200	                          \     / 
01300	                           \   / 
01400	                            \-/        P2
01500	                         B3  !         !
01600	                             !         !
01700	                           ***************      FP9   -   P7
01800	                      OSC  *             *        \  / \  / 
01900	                           *             *         \/   \/ 
02000	                           *     P10     *         /     \  MLT
02100	                            *           *          \  X  /
02200	                             *         *            \   /
02300	                              *********              \-/
02400	                              B3  !-------   ---------! B5
02500	                                         !   !
02600	                                        -!---!-        
02700	                                        \     /       
02800	                                    AD2  \ + /      FP9
02900	       	 P4         P2  	          \-/        !
03000	      	  !         !			B3 !         !
03100	      	  !         !			   !         !
03200	      	***************			 ***************
03300	      	*	      *	 OSC  		 * 	       *   OSC
03400	      	*             *         	 *             *
03500	      	*     P5      *      		 *     F1      *
03600	         *           * 			  *           *
03700	          *         * 			   *         *
03800	      	   ********* 	      FP3	    *********
03900	      	   B4  !	       !   -------------!  B3
04000	      	       !--------      -!---!-
04100	      		       !      \     /
04200	      		       !       \ + / AD2
04300	      		       !        \-/
04400	      		       !         ! B3
04500	      		       !         !
04600	      		     ***************     INS 1;
04700	      		     *		   *     FM
04800	      	        NOS  *             *     ;
04900	      	             *     P6      *     SUB P8 P7 B3;
05000	      	              *           *      MLT B3 FP9 B3;
05100	      		       *         *       OSC B3 P2 B3 P10;
05200	      		        *********        MLT FP9 P7 B5;
05300	      		        B4  !	         AD2 B3 B5 B3;      
05400	      		            !	         OSC B3 FP9 B3 F1;
05500	      		          *****	         AD2 FP3 B3 B3;      
05600	      		         * OUT *         OSC P4 P2 B4 P5;       
05700	      		         * B1  *         NOS B4 B3 B4 F1;
05800	      		          *****	         OUT B4 B1; END;
05900	        
06000	
06100	
06200	        
06300	        
06400	      	You will notice that the last OSC is  here  changed  to a NOS.
06500	      	This is necessary because FM often requires that the frequency
06600	      	given the last unit generator is negative.  If an OSC  were
06700	      	used here an error would result.
06800	        
06900	        The following functions should be set up to test the FM instrument.
07000	        
07100	      	SIN 1   1 1 ;   < A sine wave.
07200	      	SEG 2  0,1  .9,4  1,8  1,72  .8,88  .5,95  0,100; < Envelope
07300	      	SEG 3  0,1  1,100;  < An upward slope or ramp.
07400	        
07500	      The following will produce a shift from a pure sine tone to a
07600	      highly modulated tone over a period of 2 seconds.
07700	        
07800	      	  FM 0 2 100 1000 F2   F1 0 10 100 F3  F1; FINI;
07900	        
08000	        
08100	      To reverse the procedure, i.e. change from the modulated tone
08200	      to the pure tone, reverse the values of P7 and P8.
08300	        
08400	      	P7=10; P8=0;  FM;FINI;
08500	        
08600	        
08700	      Change F2 (the ramp) to make the modulation  emerge  only  in
08800	      the mid-part of the note.
08900	        
09000	      	SEG 2  0,1  1,50  0,100;  < Makes a triangle.
09100	        
09200	      	 FM;FINISH;
09300	        
09400	     Try several of the variations suggested in Chowning's article on FM.
09500	        
09600	
     

00100	      *********  STEREO SOUND  ***************
00200	        
00300	      		 P4         P2
00400	      		  !         !
00500	      		  !         !
00600	      		***************
00700	      		*             *    OSC
00800	      		*             *    
00900	      	        *     P5      *
01000	      	         *           *
01100	      		  *         *
01200	      		   *********
01300	       		   B3  !
01400	      		       ! 	FP3
01500	      		       !         !
01600	      		       !         !
01700	      		     ***************
01800	      		     *             *    OSC
01900	      		     *             *    
02000	      	             *     P6      *
02100	      	              *           *
02200	      		       *         *   P8   P7      
02300	      		        *********    -!---!-   
02400	      			B3  !        \     /
02500	      		            !	      \ - / SUB
02600	                           / \ 	    B2 \-/     
02700	                  P7      /   \       --!      
02800	                   \  -  /     \  -  /         CHA=2; <THE = IS NEEDED.
02900	                    \/ \/       \/ \/          INS 8;
03000	                    / X \       / X \          STER   
03100	               MLT  \   /       \   / MLT      ;    
03200	                     \ /         \ /           OSC P4 P2 B3 P5;
03300	                      V           V            OSC B3 FP3 B3 P6;
03400	      		   B4 !        B5 !	       MLT P7 B3 B4;
03500	      		      !----   ----!  	       SUB P8 P7 B2;
03600	      		           \ /        	       MLT B3 B2 B5;
03700	                           ! !                 STR B4,B5,B1;
03800	                          *****                END;
03900	                         * STR *
04000	                         * B1  * 
04100	                          ***** 
04200	        
04300	        
04400	        
04500	      	      Any instrument may have stereo capability by simply replacing
04600	      the  last  unit  generator  OUT  with STR (=stereo).  CHA or NCHNS is
04700	      normally  set  to 1 in MUS11.  For stereo CHA must be set to 2.  This
04800	      causes the sound samples to be multiplexed. That is, the odd numbered
04900	      samples  will  be for channel A and the even numbered samples will be
05000	      for channel B.  (Thus twice as many samples are computed for the same 
05100	      duration of sound.)
05200	        
05300	             In the above example the use of P8=1 and a number between zero 
05400	      and 1 in P7 will control the stereo position.   If P7←1 all the sound 
05500	      will be directed to channel A.  If P7←0 allthe sound will be directed
05600	      to channel B.  When P7=.5  then  50%  of  the  sound  will go to each 
05700	      channel.  Try the following:
05800	        
05900	               STER 0 .3 A 1000 F2 F1 1 1; P7←0; STER .4; FINISH;
06000	        
06100	      Note  that  a  unit generator may replace P7.  Thus, depending upon 
06200	      the shape of the function used, a single, continuous sound may be 
06300	      caused to move from channel to channel.
06400